Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make logging persistent by logging to files on host #43

Merged
merged 15 commits into from
Nov 28, 2023
Merged

Conversation

ctmbl
Copy link
Contributor

@ctmbl ctmbl commented Nov 24, 2023

How does it work:
share a volume with the host
host folder path configurable through LOG_FOLDER, container folder is /opt/root-pythia/logs
write to RootPythia.log file inside this folder, created if it doesn't exist, append to it if it exists
the same formatter than for the usual stream logging is uses (the discordpy one)
it uses a RotatingFileHandler to avoid log file to grow indefinitely
the max size of a log file is configurable through LOG_FILE_SIZE_MAX in bytes, default is 10MB
once the file has reached its max size it is renamed RootPythia.log.1 silently by the handler which continues to wirte to a brand new RootPythia.log file
the number of old log file kept is configurable through LOG_FILES_NUMBER

everything has been tested

@ctmbl ctmbl self-assigned this Nov 24, 2023
@ctmbl ctmbl added the enhancement New feature or request label Nov 24, 2023
@ctmbl
Copy link
Contributor Author

ctmbl commented Nov 24, 2023

I just added another handler to write warning error and critical logs to another file to ease readibility of tehse errors

Copy link
Contributor

@ZynoXelek ZynoXelek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything seems good to me !

@ctmbl ctmbl merged commit 2681ca2 into iScsc:main Nov 28, 2023
2 checks passed
@ctmbl ctmbl deleted the log2file branch November 28, 2023 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants